import {Component, OnInit} from "@angular/core";
import {Game} from "./gameScript/tankFighter/core/Game";
import {GameApi} from "../../api/GameApi";
import {Urls} from "../../api/ApiUrl";
import {ActivatedRoute, Router} from "@angular/router";
import {Utils} from "./gameScript/tankFighter/utils/Utils";


@Component({
  selector: 'game',
  templateUrl: './game.component.html',
  styleUrls: ['./game.component.scss']
})
export class GameComponent implements OnInit {
  route: ActivatedRoute
  router: Router
  game: Game | undefined
  changeXY = (x: number, y: number, x2: number, y2: number) => {
    if (x != this.blockX) {
      this.blockX = x;
    }

    if (y != this.blockY) {
      this.blockY = y
    }

    if (x2 != this.blockX2) {
      this.blockX2 = x2;
    }

    if (y2 != this.blockY2) {
      this.blockY2 = y2
    }
  }


  constructor(route: ActivatedRoute, router: Router) {
    this.route = route;
    this.router = router;
  }

  blockX = 0
  blockY = 0
  getX = (): string => {
    return this.blockX + 'px'
  }
  getY = (): string => {
    return this.blockY + 'px'
  }

  blockX2 = 0
  blockY2 = 0
  getX2 = (): string => {
    return this.blockX2 + 'px'
  }
  getY2 = (): string => {
    return this.blockY2 + 'px'
  }


  title = 'untitled1';

  ngOnInit(): void {
  }


}
